package com.ck;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloworldController {

//	@RequestMapping(value = "/", method = RequestMethod.GET)
//	public String index(Model model) {
//		model.addAttribute("msg", "springmvc helloworldc.");
//		System.out.println("1");
//		return "index";
//	}

	@RequestMapping(value = "/springmvc/helloworld", method = RequestMethod.GET)
	public String helloworld(Model model,HttpSession session) {
		model.addAttribute("msg", "springmvc helloworldc.");
		return "helloworld";
	}
	
	  @RequestMapping(value = "/ajaxTest", method = RequestMethod.GET)
	 @ResponseBody  
	  public Map<String, String> ajaxTest() {
	    Map<String, String> map = new HashMap<String, String>(1);  
	    map.put("success", "true");  
	    map.put("data", "./view/index.html");
	    return map;  
	  }  
	
}